//
//  VolunteerNovelService.m
//  HZHome
//
//  Created by Alawn on 13-10-13.
//  Copyright (c) 2013年 xzysun. All rights reserved.
//

#import "VolunteerNovelService.h"
#import "VolunteerEntity.h"
#import "VolunteerCell.h"
@implementation VolunteerNovelService
-(id)init
{
    self = [super init];
    if (self) {
        _dataItemName = @"VolunteerEntity";
    }
    return self;
}
-(void)loadDataWithKey:(NSString *)keyOrNil
{
    _currentPageNo = 1;//刷新或查询的时候将请求页码变为1
    if (self.dataList) {
        self.dataList = nil;
    }
    NSMutableDictionary *params = [NSMutableDictionary dictionary];
    [params setValue:@"27" forKey:@"popularize_scope"];//街道id来自街道定制的！
    if (keyOrNil) {
        [params setValue:keyOrNil forKey:@"title"];
    } else {
        [params setValue:@"" forKey:@"title"];
    }
    [self doHttpPost:VOLUNTEERNOVEL headers:nil path:[NSString stringWithFormat:@"/%d",_currentPageNo] parameters:params];
}

-(void)loadMoreDataWithKey:(NSString *)keyOrNil
{
    NSMutableDictionary *params = [NSMutableDictionary dictionary];
    [params setValue:@"27" forKey:@"popularize_scope"];//街道id来自街道定制的！
    if (keyOrNil) {
        [params setValue:keyOrNil forKey:@"title"];
    } else {
        [params setValue:@"" forKey:@"title"];
    }
    [self doHttpPost:VOLUNTEERNOVEL headers:nil path:[NSString stringWithFormat:@"/%d",_currentPageNo+1] parameters:params];
}

-(void)configCell:(UITableViewCell *)cell atIndex:(NSIndexPath *)index
{
    VolunteerEntity *item = [self.dataList objectAtIndex:index.row];
    VolunteerCell *tempCell = (VolunteerCell *)cell;
    tempCell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    tempCell.titleLabel.text = item.title;
}

-(NSDictionary *)getTargetConfigForCellAtIndex:(NSIndexPath *)indexPath
{
    VolunteerEntity *item = [self.dataList objectAtIndex:indexPath.row];
    NSDictionary *dic = [NSDictionary dictionaryWithObjectsAndKeys:@"志愿者新鲜详情",@"key",item,@"dataItem", nil];
    return dic;
}
@end
